package com.example.jetpacktest.adapter

import android.content.Context
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.TextView
import androidx.recyclerview.widget.RecyclerView
import com.example.jetpacktest.R

class VP2Adapter001(val datas: List<String>, val context: Context): RecyclerView.Adapter<VP2Adapter001.MyViewHolder>() {


    override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): MyViewHolder {
        val itemView = LayoutInflater.from(context).inflate(R.layout.item_viewpager2_test001, parent, false)
        return MyViewHolder(itemView)
    }

    override fun onBindViewHolder(holder: MyViewHolder, position: Int) {
        holder.textView.text = datas[position]
    }

    override fun getItemCount(): Int {
        return datas.size
    }

    class MyViewHolder(itemView: View): RecyclerView.ViewHolder(itemView){
        val textView: TextView

        init {
            textView = itemView.findViewById(R.id.textView)
        }
    }

}